
#ifndef MANAGER_H
#define MANAGER_H

#include <map>
#include <string>
#include <cassert>

// patron singleton

template <class T>
class Manager{

public:

	std::map<std::string, T*> datos;

	T* get(std::string name){
		std::map<std::string, T*>::iterator it = datos.find(name);
		if(it == datos.end()){
			T* obj = load(name);
			datos[name] = obj;
			return obj;
		}
		return it->second;
	}

	virtual T* load(std::string filename) = 0;

	Manager(){
	}
};

#endif